/*************************************************************************************************************************************************************************************************
Do file #1 for "The Mainstreaming of Marx: Measuring the Effect of the Russian Revolution on Karl Marx’s Influence"
by Phil Magness and Michael Makovi

Do file itself is by Michael Makovi

This first do file inputs all the Excel spreadsheets and converts them into a Stata DTA file.
**************************************************************************************************************************************************************************************************/

/**********************************************************
Change the current directory to the folder containing the data files.

This do file is contained in a folder named "do files", which is in turn contained
within the master folder. Below that master folder is the "data files" folder.

So move up a directory then down a directory. 
"do files" --> master folder --> "data files"
*********************************************************/
clear
cd ..
cd "data files"

/*
We begin with a spreadsheet of Ngram citation counts, with one author per sheet
We do the following:
(1) Read in each sheet, one at a time

(2) Each sheet corresponds to an author. Create a variable "Name" with that author's name. Rename other variables to be consistent.

(3) Save the result as a DTA file

(4) Repeat for every other author, reading every sheet one at a time
*/

* This program makes variables for every author consistent.
* First, we "keep Year English German French Spanish".
* Second, authors have their names spelled differently in different languages.
* For example, Aristotle is Aristoteles in German, Aristote in French, and Aristóteles in Spanish.
* These alternate spellings are reflected in the spreadsheet. For example, we have a column named "German – Aristoteles".
* So we "rename German German", "rename French French" and "rename Spanish Spanish" to make all the variables consistent in their naming.
* This works because in Stata, if you have a variable named "AB", then "rename A X", it will rename "AB" as "A" as long as there is no 
* other variable named AC to create ambiguity (does "A" refer to "AB" or "AC"?).
capture program drop MakeVariablesConsistent
program define MakeVariablesConsistent 
	keep Year English German French Spanish
	rename German German 
	rename French French 
	rename Spanish Spanish
end

/**********************************************************
* First set of authors
* We input each sheet of each spreadsheet separately, and
* convert to DTA - each sheet becoming one DTA.
**********************************************************/

* We have citations for both "Karl Marx" as well as "Marx"
* Here, we generate data for "Karl Marx"
clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Karl Marx") firstrow
MakeVariablesConsistent
generate Name = "Karl Marx"
save "KarlMarx.dta", replace

* We have citations for both "Karl Marx" as well as "Marx"
* Here, we generate data for "Marx"
clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Karl Marx") firstrow
keep Year Marx0
rename Marx0 English
generate Name = "Marx"
save "Marx.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Adam Smith") firstrow
MakeVariablesConsistent
generate Name = "Adam Smith"
save "AdamSmith.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Robert Owen") firstrow
MakeVariablesConsistent
generate Name = "Robert Owen"
save "RobertOwen.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Henry George") firstrow
MakeVariablesConsistent
generate Name = "Henry George"
save "HenryGeorge.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Herbert Spencer") firstrow
MakeVariablesConsistent
generate Name = "Herbert Spencer"
save "HerbertSpencer.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Alexander Hamilton") firstrow
MakeVariablesConsistent
generate Name = "Alexander Hamilton"
save "AlexanderHamilton.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("James Madison") firstrow
MakeVariablesConsistent
generate Name = "James Madison"
save "JamesMadison.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("John Stuart Mill") firstrow
MakeVariablesConsistent
generate Name = "John Stuart Mill"
save "JohnStuartMill.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Thomas Carlyle") firstrow
MakeVariablesConsistent
generate Name = "Thomas Carlyle"1
save "ThomasCarlyle.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("John Ruskin") firstrow
MakeVariablesConsistent
generate Name = "John Ruskin"
save "JohnRuskin.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("John Locke") firstrow
MakeVariablesConsistent
generate Name = "John Locke"
save "JohnLocke.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Charles Darwin") firstrow
MakeVariablesConsistent
generate Name = "Charles Darwin"
save "CharlesDarwin.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Proudhon") firstrow
MakeVariablesConsistent
generate Name = "Proudhon"
save "Proudhon.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Kropotkin") firstrow
MakeVariablesConsistent
generate Name = "Kropotkin"
save "Kropotkin.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Blanqui") firstrow
MakeVariablesConsistent
generate Name = "Blanqui"
save "Blanqui.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Tocqueville") firstrow
MakeVariablesConsistent
generate Name = "Tocqueville"
save "Tocqueville.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Bakunin") firstrow
MakeVariablesConsistent
generate Name = "Bakunin"
save "Bakunin.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Immanuel Kant") firstrow
MakeVariablesConsistent
generate Name = "Immanuel Kant"
save "ImmanuelKant.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("David Ricardo") firstrow
MakeVariablesConsistent
generate Name = "David Ricardo"
save "DavidRicardo.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Bastiat") firstrow
MakeVariablesConsistent
generate Name = "Bastiat"
save "Bastiat.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Malthus") firstrow
MakeVariablesConsistent
generate Name = "Malthus"
save "Malthus.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Montesquieu") firstrow
MakeVariablesConsistent
generate Name = "Montesquieu"
save "Montesquieu.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Edmund Burke") firstrow
MakeVariablesConsistent
generate Name = "Edmund Burke"
save "EdmundBurke.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Thomas Hobbes") firstrow
MakeVariablesConsistent
generate Name = "Hobbes"
save "Hobbes.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Machiavelli") firstrow
MakeVariablesConsistent
generate Name = "Machiavelli"
save "Machiavelli.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Rodbertus") firstrow
MakeVariablesConsistent
generate Name = "Rodbertus"
save "Rodbertus.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Ludwig Feuerbach") firstrow
MakeVariablesConsistent
generate Name = "Ludwig Feuerbach"
save "LudwigFeuerbach.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Thomas Jefferson") firstrow
MakeVariablesConsistent
generate Name = "Thomas Jefferson"
save "ThomasJefferson.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Fichte") firstrow
MakeVariablesConsistent
generate Name = "Fichte"
save "Fichte.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Aristotle") firstrow
MakeVariablesConsistent
generate Name = "Aristotle"
save "Aristotle.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Plato") firstrow
MakeVariablesConsistent
generate Name = "Plato"
save "Plato.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Voltaire") firstrow
MakeVariablesConsistent
generate Name = "Voltaire"
save "Voltaire.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("William Graham Sumner") firstrow
MakeVariablesConsistent
generate Name = "William Graham Sumner"
save "WilliamGrahamSumner.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Auberon Herbert") firstrow
MakeVariablesConsistent
generate Name = "Auberon Herbert"
save "AuberonHerbert.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Lord Acton") firstrow
MakeVariablesConsistent
generate Name = "Lord Acton"
save "LordActon.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Charles Fourier") firstrow
MakeVariablesConsistent
generate Name = "Charles Fourier"
save "CharlesFourier.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Edward Bellamy") firstrow
MakeVariablesConsistent
generate Name = "Edward Bellamy"
save "EdwardBellamy.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Wollstonecraft") firstrow
MakeVariablesConsistent
generate Name = "Wollstonecraft"
save "Wollstonecraft.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Spinoza") firstrow
MakeVariablesConsistent
generate Name = "Spinoza"
save "Spinoza.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Bentham") firstrow
MakeVariablesConsistent
generate Name = "Bentham"
save "Bentham.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Hume") firstrow
MakeVariablesConsistent
generate Name = "Hume"
save "Hume.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("John C. Calhoun") firstrow
MakeVariablesConsistent
generate Name = "John C. Calhoun"
save "JohnCCalhoun.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Friedrich List") firstrow
MakeVariablesConsistent
generate Name = "Friedrich List"
save "FriedrichList.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Durkheim") firstrow
MakeVariablesConsistent
generate Name = "Durkheim"
save "Durkheim.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Ferdinand Lassalle") firstrow
MakeVariablesConsistent
generate Name = "Ferdinand Lassalle"
save "FerdinandLassalle.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Auguste Comte") firstrow
MakeVariablesConsistent
generate Name = "Auguste Comte"
save "AugusteComte.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Sismondi") firstrow
MakeVariablesConsistent
generate Name = "Sismondi"
save "Sismondi.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Rousseau") firstrow
MakeVariablesConsistent
generate Name = "Rousseau"
save "Rousseau.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("William Godwin") firstrow
MakeVariablesConsistent
generate Name = "William Godwin"
save "WilliamGodwin.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Nassau Senior") firstrow
MakeVariablesConsistent
generate Name = "Nassau Senior"
save "NassauSenior.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Leibniz") firstrow
MakeVariablesConsistent
generate Name = "Leibniz"
save "Leibniz.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Alexander Pope") firstrow
MakeVariablesConsistent
generate Name = "Alexander Pope"
save "AlexanderPope.dta", replace

clear
import excel "Marx1850-2000-Ngram - 1st set of authors - brainstorming.xlsx", sheet("Hegel") firstrow
MakeVariablesConsistent
generate Name = "Hegel"
save "Hegel.dta", replace

/**********************************************************
* Second set of authors
**********************************************************/

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Thoreau") firstrow
MakeVariablesConsistent
generate Name = "Thoreau"
save "Thoreau.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Benjamin Constant") firstrow
MakeVariablesConsistent
generate Name = "Benjamin Constant"
save "BenjaminConstant.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("James Fitzjames Stephen") firstrow
MakeVariablesConsistent
generate Name = "James Fitzjames Stephen"
save "JamesFitzjamesStephen.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Richard Cobden") firstrow
MakeVariablesConsistent
generate Name = "Richard Cobden"
save "RichardCobden.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Nietzsche") firstrow
MakeVariablesConsistent
generate Name = "Nietzsche"
save "Nietzsche.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Oscar Wilde") firstrow
MakeVariablesConsistent
generate Name = "Oscar Wilde"
save "OscarWilde.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Friedrich Schiller") firstrow
MakeVariablesConsistent
generate Name = "Friedrich Schiller"
save "FriedrichSchiller.dta", replace


clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Dostoyevsky") firstrow
MakeVariablesConsistent
generate Name = "Dostoyevsky"
save "Dostoyevsky.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Thucydides") firstrow
MakeVariablesConsistent
generate Name = "Thucydides"
save "Thucydides.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Cicero") firstrow
MakeVariablesConsistent
generate Name = "Cicero"
save "Cicero.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Augustine") firstrow
MakeVariablesConsistent
generate Name = "Augustine"
save "Augustine.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Aquinas") firstrow
MakeVariablesConsistent
generate Name = "Aquinas"
save "Aquinas.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Martin Luther") firstrow
MakeVariablesConsistent
generate Name = "Martin Luther"
save "MartinLuther.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("John Calvin") firstrow
MakeVariablesConsistent
generate Name = "John Calvin"
save "JohnCalvin.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Jonathan Swift") firstrow
MakeVariablesConsistent
generate Name = "Jonathan Swift"
save "JonathanSwift.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("de Gouges") firstrow
MakeVariablesConsistent
generate Name = "de Gouges"
save "deGouges.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Frederick Douglass") firstrow
MakeVariablesConsistent
generate Name = "Frederick Douglass"
save "FrederickDouglass.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Abraham Lincoln") firstrow
MakeVariablesConsistent
generate Name = "Abraham Lincoln"
save "AbrahamLincoln.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Pericles") firstrow
MakeVariablesConsistent
generate Name = "Pericles"
save "Pericles.dta", replace

clear
import excel "Marx1850-2000-Ngram - 2nd set of authors - pol phil readers.xlsx", sheet("Aesop") firstrow
MakeVariablesConsistent
generate Name = "Aesop"
save "Aesop.dta", replace

/**********************************************************
* Third set of authors
**********************************************************/

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Benjamin Franklin") firstrow
MakeVariablesConsistent
generate Name = "Benjamin Franklin"
save "BenjaminFranklin.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("John Woolman") firstrow
MakeVariablesConsistent
generate Name = "John Woolman"
save "JohnWoolman.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("William Penn") firstrow
MakeVariablesConsistent
generate Name = "William Penn"
save "WilliamPenn.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Epictetus") firstrow
MakeVariablesConsistent
generate Name = "Epictetus"
save "Epictetus.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Marcus Aurelius") firstrow
MakeVariablesConsistent
generate Name = "Marcus Aurelius"
save "MarcusAurelius.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Francis Bacon") firstrow
MakeVariablesConsistent
generate Name = "Francis Bacon"
save "FrancisBacon.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("John Milton") firstrow
MakeVariablesConsistent
generate Name = "John Milton"
save "JohnMilton.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Thomas Browne") firstrow
MakeVariablesConsistent
generate Name = "Thomas Browne"
save "ThomasBrowne.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Ralph Waldo Emerson") firstrow
MakeVariablesConsistent
generate Name = "Ralph Waldo Emerson"
save "RalphWaldoEmerson.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Robert Burns") firstrow
MakeVariablesConsistent
generate Name = "Robert Burns"
save "RobertBurns.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Kempis") firstrow
MakeVariablesConsistent
generate Name = "Kempis"
save "Kempis.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Aeschylus") firstrow
MakeVariablesConsistent
generate Name = "Aeschylus"
save "Aeschylus.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Sophocles") firstrow
MakeVariablesConsistent
generate Name = "Sophocles"
save "Sophocles.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Euripides") firstrow
MakeVariablesConsistent
generate Name = "Euripides"
save "Euripides.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Aristophanes") firstrow
MakeVariablesConsistent
generate Name = "Aristophanes"
save "Aristophanes.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Pliny the Younger") firstrow
MakeVariablesConsistent
generate Name = "Pliny the Younger"
save "PlinytheYounger.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Plutarch") firstrow
MakeVariablesConsistent
generate Name = "Plutarch"
save "Plutarch.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Virgil") firstrow
MakeVariablesConsistent
generate Name = "Virgil"
save "Virgil.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Cervantes") firstrow
MakeVariablesConsistent
generate Name = "Cervantes"
save "Cervantes.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("John Bunyan") firstrow
MakeVariablesConsistent
generate Name = "John Bunyan"
save "JohnBunyan.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Izaak Walton") firstrow
MakeVariablesConsistent
generate Name = "Izaak Walton"
save "IzaakWalton.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Hans Christian Andersen") firstrow
MakeVariablesConsistent
generate Name = "Hans Christian Andersen"
save "HansChristianAndersen.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Dryden") firstrow
MakeVariablesConsistent
generate Name = "Dryden"
save "Dryden.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Oliver Goldsmith") firstrow
MakeVariablesConsistent
generate Name = "Oliver Goldsmith"
save "OliverGoldsmith.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Percy Bysshe Shelley") firstrow
MakeVariablesConsistent
generate Name = "Percy Bysshe Shelley"
save "PercyByssheShelley.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Robert Browning") firstrow
MakeVariablesConsistent
generate Name = "Robert Browning"
save "RobertBrowning.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Lord Byron") firstrow
MakeVariablesConsistent
generate Name = "Lord Byron"
save "LordByron.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Goethe") firstrow
MakeVariablesConsistent
generate Name = "Goethe"
save "Goethe.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Marlowe") firstrow
MakeVariablesConsistent
generate Name = "Marlowe"
save "Marlowe.dta", replace

clear
import excel "Marx1850-2000-Ngram - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Dante Alighieri") firstrow
MakeVariablesConsistent
generate Name = "Dante Alighieri"
save "DanteAlighieri.dta", replace

clear

/**********************************************************
Fourth set of authors
**********************************************************/

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Alessandro Manzoni") firstrow
MakeVariablesConsistent
generate Name = "Alessandro Manzoni"
save "AlessandroManzoni.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Homer") firstrow
MakeVariablesConsistent
generate Name = "Homer"
save "Homer.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Pedro Calderón de la Barca") firstrow
MakeVariablesConsistent
generate Name = "Pedro Calderón de la Barca"
save "PedroCalderóndelaBarca.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Pierre Corneille") firstrow
MakeVariablesConsistent
generate Name = "Pierre Corneille"
save "PierreCorneille.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Jean Racine") firstrow
MakeVariablesConsistent
generate Name = "Jean Racine"
save "JeanRacine.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Molière") firstrow
MakeVariablesConsistent
generate Name = "Molière"
save "Molière.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Gotthold Ephraim Lessing") firstrow
MakeVariablesConsistent
generate Name = "Gotthold Ephraim Lessing"
save "GottholdEphraimLessing.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Faraday") firstrow
MakeVariablesConsistent
generate Name = "Faraday"
save "Faraday.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Helmholtz") firstrow
MakeVariablesConsistent
generate Name = "Helmholtz"
save "Helmholtz.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Kelvin") firstrow
MakeVariablesConsistent
generate Name = "Kelvin"
save "Kelvin.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Simon Newcomb") firstrow
MakeVariablesConsistent
generate Name = "Simon Newcomb"
save "SimonNewcomb.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Archibald Geikie") firstrow
MakeVariablesConsistent
generate Name = "Archibald Geikie"
save "ArchibaldGeikie.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Cellini") firstrow
MakeVariablesConsistent
generate Name = "Cellini"
save "Cellini.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Montaigne") firstrow
MakeVariablesConsistent
generate Name = "Montaigne"
save "Montaigne.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Sainte-Beuve") firstrow
MakeVariablesConsistent
generate Name = "Sainte-Beuve"
save "SainteBeuve.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Renan") firstrow
MakeVariablesConsistent
generate Name = "Renan"
save "Renan.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Mazzini") firstrow
MakeVariablesConsistent
generate Name = "Mazzini"
save "Mazzini.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Herodotus") firstrow
MakeVariablesConsistent
generate Name = "Herodotus"
save "Herodotus.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Tacitus") firstrow
MakeVariablesConsistent
generate Name = "Tacitus"
save "Tacitus.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Philip Nichols") firstrow
MakeVariablesConsistent
generate Name = "Philip Nichols"
save "PhilipNichols.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Francis Pretty") firstrow
MakeVariablesConsistent
generate Name = "Francis Pretty"
save "FrancisPretty.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Bigges") firstrow
MakeVariablesConsistent
generate Name = "Bigges"
save "Bigges.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Edward Haies") firstrow
MakeVariablesConsistent
generate Name = "Edward Haies"
save "EdwardHaies.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Walter Raleigh") firstrow
MakeVariablesConsistent
generate Name = "Walter Raleigh"
save "WalterRaleigh.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Descartes") firstrow
MakeVariablesConsistent
generate Name = "Descartes"
save "Descartes.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Froissart") firstrow
MakeVariablesConsistent
generate Name = "Froissart"
save "Froissart.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Malory") firstrow
MakeVariablesConsistent
generate Name = "Malory"
save "Malory.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("William Harrison") firstrow
MakeVariablesConsistent
generate Name = "William Harrison"
save "WilliamHarrison.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("William Roper") firstrow
MakeVariablesConsistent
generate Name = "William Roper"
save "WilliamRoper.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Thomas More") firstrow
MakeVariablesConsistent
generate Name = "Thomas More"
save "ThomasMore.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Hippocrates") firstrow
MakeVariablesConsistent
generate Name = "Hippocrates"
save "Hippocrates.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Ambroise Paré") firstrow
MakeVariablesConsistent
generate Name = "Ambroise Paré"
save "AmbroiseParé.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("William Harvey") firstrow
MakeVariablesConsistent
generate Name = "William Harvey"
save "WilliamHarvey.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Edward Jenner") firstrow
MakeVariablesConsistent
generate Name = "Edward Jenner"
save "EdwardJenner.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Oliver Wendell Holmes") firstrow
MakeVariablesConsistent
generate Name = "Oliver Wendell Holmes"
save "OliverWendellHolmes.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Joseph Lister") firstrow
MakeVariablesConsistent
generate Name = "Joseph Lister"
save "JosephLister.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Pasteur") firstrow
MakeVariablesConsistent
generate Name = "Pasteur"
save "Pasteur.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("William Caxton") firstrow
MakeVariablesConsistent
generate Name = "William Caxton"
save "WilliamCaxton.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Copernicus") firstrow
MakeVariablesConsistent
generate Name = "Copernicus"
save "Copernicus.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("John Knox") firstrow
MakeVariablesConsistent
generate Name = "John Knox"
save "JohnKnox.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Edmund Spenser") firstrow
MakeVariablesConsistent
generate Name = "Edmund Spenser"
save "EdmundSpenser.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Newton") firstrow
MakeVariablesConsistent
generate Name = "Newton"
save "Newton.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Henry Fielding") firstrow
MakeVariablesConsistent
generate Name = "Henry Fielding"
save "HenryFielding.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Samuel Johnson") firstrow
MakeVariablesConsistent
generate Name = "Samuel Johnson"
save "SamuelJohnson.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("William Wordsworth") firstrow
MakeVariablesConsistent
generate Name = "William Wordsworth"
save "WilliamWordsworth.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Victor Hugo") firstrow
MakeVariablesConsistent
generate Name = "Victor Hugo"
save "VictorHugo.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Walt Whitman") firstrow
MakeVariablesConsistent
generate Name = "Walt Whitman"
save "WaltWhitman.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Hippolyte Taine") firstrow
MakeVariablesConsistent
generate Name = "Hippolyte Taine"
save "Hippolyte Taine.dta", replace

clear
import excel "Marx1850-2000-Ngram - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Chaucer") firstrow
MakeVariablesConsistent
generate Name = "Chaucer"
save "Chaucer.dta", replace

/**********************************************************
Fifth set of authors
**********************************************************/

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Dilthey") firstrow
MakeVariablesConsistent
generate Name = "Dilthey"
save "Dilthey.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Frege") firstrow
MakeVariablesConsistent
generate Name = "Frege"
save "Frege.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Schleiermacher") firstrow
MakeVariablesConsistent
generate Name = "Schleiermacher"
save "Schleiermacher.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Schopenhauer") firstrow
MakeVariablesConsistent
generate Name = "Schopenhauer"
save "Schopenhauer.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Kafka") firstrow
MakeVariablesConsistent
generate Name = "Kafka"
save "Kafka.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Clausewitz") firstrow
MakeVariablesConsistent
generate Name = "Clausewitz"
save "Clausewitz.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Franz Brentano") firstrow
MakeVariablesConsistent
generate Name = "Franz Brentano"
save "FranzBrentano.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Ludwig Büchner") firstrow
MakeVariablesConsistent
generate Name = "Ludwig Büchner"
save "LudwigBüchner.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Hermann Cohen") firstrow
MakeVariablesConsistent
generate Name = "Hermann Cohen"
save "HermannCohen.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Eduard von Hartmann") firstrow
MakeVariablesConsistent
generate Name = "Eduard von Hartmann"
save "EduardvonHartmann.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Hölderlin") firstrow
MakeVariablesConsistent
generate Name = "Hölderlin"
save "Hölderlin.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Wilhelm von Humboldt") firstrow
MakeVariablesConsistent
generate Name = "Wilhelm von Humboldt"
save "WilhelmvonHumboldt.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Otto Pfleiderer") firstrow
MakeVariablesConsistent
generate Name = "Otto Pfleiderer"
save "OttoPfleiderer.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Hermann Lotze") firstrow
MakeVariablesConsistent
generate Name = "Hermann Lotze"
save "HermannLotze.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Heinrich Feder") firstrow
MakeVariablesConsistent
generate Name = "Heinrich Feder"
save "HeinrichFeder.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Moses Mendelssohn") firstrow
MakeVariablesConsistent
generate Name = "Moses Mendelssohn"
save "MosesMendelssohn.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Friedrich Ast") firstrow
MakeVariablesConsistent
generate Name = "Friedrich Ast"
save "FriedrichAst.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Bruno Bauer") firstrow
MakeVariablesConsistent
generate Name = "Bruno Bauer"
save "BrunoBauer.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Sigismund Beck") firstrow
MakeVariablesConsistent
generate Name = "Sigismund Beck"
save "SigismundBeck.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Eduard Beneke") firstrow
MakeVariablesConsistent
generate Name = "Eduard Beneke"
save "EduardBeneke.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Amadeus Wendt") firstrow
MakeVariablesConsistent
generate Name = "Amadeus Wendt"
save "AmadeusWendt.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Wilhelm Roscher") firstrow
MakeVariablesConsistent
generate Name = "Wilhelm Roscher"
save "WilhelmRoscher.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Wilhelm Drobisch") firstrow
MakeVariablesConsistent
generate Name = "Wilhelm Drobisch"
save "WilhelmDrobisch.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Rudolf Haym") firstrow
MakeVariablesConsistent
generate Name = "Rudolf Haym"
save "RudolfHaym.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Gustav Schönberg") firstrow
MakeVariablesConsistent
generate Name = "Gustav Schönberg"
save "GustavSchönberg.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Otto Liebmann") firstrow
MakeVariablesConsistent
generate Name = "Otto Liebmann"
save "OttoLiebmann.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Friedrich Krause") firstrow
MakeVariablesConsistent
generate Name = "Friedrich Krause"
save "FriedrichKrause.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Christian Schreiber") firstrow
MakeVariablesConsistent
generate Name = "Christian Schreiber"
save "ChristianSchreiber.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Wentscher") firstrow
MakeVariablesConsistent
generate Name = "Wentscher"
save "Wentscher.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Theodor Lipps") firstrow
MakeVariablesConsistent
generate Name = "Theodor Lipps"
save "TheodorLipps.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Ranke") firstrow
MakeVariablesConsistent
generate Name = "Ranke"
save "Ranke.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Barthold Georg Niebuhr") firstrow
MakeVariablesConsistent
generate Name = "Barthold Georg Niebuhr"
save "BartholdGeorgNiebuhr.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Herbart") firstrow
MakeVariablesConsistent
generate Name = "Herbart"
save "Herbart.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Herder") firstrow
MakeVariablesConsistent
generate Name = "Herder"
save "Herder.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Lujo Brentano") firstrow
MakeVariablesConsistent
generate Name = "Lujo Brentano"
save "LujoBrentano.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Bernard Bolzano") firstrow
MakeVariablesConsistent
generate Name = "Bernard Bolzano"
save "BernardBolzano.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Schäffle") firstrow
MakeVariablesConsistent
generate Name = "Schäffle"
save "Schäffle.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Hamann") firstrow
MakeVariablesConsistent
generate Name = "Hamann"
save "Hamann.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Eugen Dühring") firstrow
MakeVariablesConsistent
generate Name = "Eugen Dühring"
save "EugenDühring.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Fritz Schultze") firstrow
MakeVariablesConsistent
generate Name = "Fritz Schultze"
save "FritzSchultze.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Moses Hess") firstrow
MakeVariablesConsistent
generate Name = "Moses Hess"
save "MosesHess.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Gottlob Ernst Schulze") firstrow
MakeVariablesConsistent
generate Name = "Gottlob Ernst Schulze"
save "GottlobErnstSchulze.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Thomas Abbt") firstrow
MakeVariablesConsistent
generate Name = "Thomas Abbt"
save "ThomasAbbt.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Dietrich Tiedemann") firstrow
MakeVariablesConsistent
generate Name = "Dietrich Tiedemann"
save "DietrichTiedemann.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Kuno Fischer") firstrow
MakeVariablesConsistent
generate Name = "Kuno Fischer"
save "KunoFischer.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Christian Wilhelm von Dohm") firstrow
MakeVariablesConsistent
generate Name = "Christian Wilhelm von Dohm"
save "ChristianWilhelmvonDohm.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Natorp") firstrow
MakeVariablesConsistent
generate Name = "Natorp"
save "Natorp.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Arnold Ruge") firstrow
MakeVariablesConsistent
generate Name = "Arnold Ruge"
save "ArnoldRuge.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Bruno Hildebrand") firstrow
MakeVariablesConsistent
generate Name = "Bruno Hildebrand"
save "BrunoHildebrand.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Karl Knies") firstrow
MakeVariablesConsistent
generate Name = "Karl Knies"
save "KarlKnies.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Laspeyres") firstrow
MakeVariablesConsistent
generate Name = "Laspeyres"
save "Laspeyres.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Friedrich Schlegel") firstrow
MakeVariablesConsistent
generate Name = "Friedrich Schlegel"
save "FriedrichSchlegel.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Mainländer") firstrow
MakeVariablesConsistent
generate Name = "Mainländer"
save "Mainländer.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Scheler") firstrow
MakeVariablesConsistent
generate Name = "Scheler"
save "Scheler.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Max Stirner") firstrow
MakeVariablesConsistent
generate Name = "Max Stirner"
save "MaxStirner.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Carl Stumpf") firstrow
MakeVariablesConsistent
generate Name = "Carl Stumpf"
save "CarlStumpf.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Ferdinand Tönnies") firstrow
MakeVariablesConsistent
generate Name = "Ferdinand Tönnies"
save "FerdinandTönnies.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Windelband") firstrow
MakeVariablesConsistent
generate Name = "Windelband"
save "Windelband.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Eduard Zeller") firstrow
MakeVariablesConsistent
generate Name = "Eduard Zeller"
save "Eduard Zeller.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Thomas Mann") firstrow
MakeVariablesConsistent
generate Name = "Thomas Mann"
save "ThomasMann.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("August Bebel") firstrow
MakeVariablesConsistent
generate Name = "August Bebel"
save "August Bebel.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Eduard Bernstein") firstrow
MakeVariablesConsistent
generate Name = "Eduard Bernstein"
save "EduardBernstein.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Friedrich Heinrich Jacobi") firstrow
MakeVariablesConsistent
generate Name = "Friedrich Heinrich Jacobi"
save "FriedrichHeinrichJacobi.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Wundt") firstrow
MakeVariablesConsistent
generate Name = "Wundt"
save "Wundt.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Simmel") firstrow
MakeVariablesConsistent
generate Name = "Simmel"
save "Simmel.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Grimmelshausen") firstrow
MakeVariablesConsistent
generate Name = "Grimmelshausen"
save "Grimmelshausen.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("E. T. A. Hoffmann") firstrow
MakeVariablesConsistent
generate Name = "E. T. A. Hoffmann"
save "E. T. A. Hoffmann.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Gustav Freytag") firstrow
MakeVariablesConsistent
generate Name = "Gustav Freytag"
save "GustavFreytag.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Theodor Fontane") firstrow
MakeVariablesConsistent
generate Name = "Theodor Fontane"
save "TheodorFontane.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Rilke") firstrow
MakeVariablesConsistent
generate Name = "Rilke"
save "Rilke.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Külpe") firstrow
MakeVariablesConsistent
generate Name = "Külpe"
save "Külpe.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Ebbinghaus") firstrow
MakeVariablesConsistent
generate Name = "Ebbinghaus"
save "Ebbinghaus.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Friedrich Carl von Savigny") firstrow
MakeVariablesConsistent
generate Name = "Friedrich Carl von Savigny"
save "FriedrichCarlvonSavigny.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Sombart") firstrow
MakeVariablesConsistent
generate Name = "Sombart"
save "Sombart.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Schmoller") firstrow
MakeVariablesConsistent
generate Name = "Schmoller"
save "Schmoller.dta", replace

clear
import excel "Marx1850-2000-Ngram - German authors.xlsx", sheet("Thünen") firstrow
MakeVariablesConsistent
generate Name = "Thünen"
save "Thünen.dta", replace

/**********************************************************
Take each separate citation DTA file - one per author, each 
created from one sheet of a spreadsheet of citation counts - 
and append them all together.
*********************************************************/
*
* First set of authors
use "KarlMarx.dta"
append using "Marx.dta"
append using "AdamSmith.dta"
append using "RobertOwen.dta"
append using "HenryGeorge.dta"
append using "HerbertSpencer.dta"
append using "AlexanderHamilton.dta"
append using "JamesMadison.dta"
append using "JohnStuartMill.dta"
append using "ThomasCarlyle.dta"
append using "JohnRuskin.dta"
append using "JohnLocke.dta"
append using "CharlesDarwin.dta"
append using "Proudhon.dta"
append using "Kropotkin.dta"
append using "Blanqui.dta"
append using "Tocqueville.dta"
append using "Bakunin.dta"
append using "ImmanuelKant.dta"
append using "DavidRicardo.dta"
append using "Bastiat.dta"
append using "Malthus.dta"
append using "Montesquieu.dta"
append using "EdmundBurke.dta"
append using "LudwigFeuerbach.dta"
append using "Machiavelli.dta"
append using "Rodbertus.dta"
append using "Hobbes.dta"
append using "ThomasJefferson.dta"
append using "Fichte.dta"
append using "Aristotle.dta"
append using "Plato.dta"
append using "Voltaire.dta"
append using "WilliamGrahamSumner.dta"
append using "AuberonHerbert.dta"
append using "LordActon.dta"
append using "CharlesFourier.dta"
append using "EdwardBellamy.dta"
append using "Wollstonecraft.dta"
append using "Spinoza.dta"
append using "Hume.dta"
append using "Bentham.dta"
append using "JohnCCalhoun.dta"
append using "FriedrichList.dta"
append using "Durkheim.dta"
append using "FerdinandLassalle.dta"
append using "AugusteComte.dta"
append using "Sismondi.dta"
append using "Rousseau.dta"
append using "WilliamGodwin.dta"
append using "NassauSenior.dta"
append using "Leibniz.dta"
append using "AlexanderPope.dta"
append using "Hegel.dta"
gen author_set = 1
*
* Second set of authors
append using "Thoreau.dta"
append using "BenjaminConstant.dta"
append using "JamesFitzjamesStephen.dta"
append using "RichardCobden.dta"
append using "Nietzsche.dta"
append using "OscarWilde.dta"
append using "FriedrichSchiller.dta"
append using "Dostoyevsky.dta"
append using "Thucydides.dta"
append using "Cicero.dta"
append using "Augustine.dta"
append using "Aquinas.dta"
append using "MartinLuther.dta"
append using "JohnCalvin.dta"
append using "JonathanSwift.dta"
append using "deGouges.dta"
append using "FrederickDouglass.dta"
append using "AbrahamLincoln.dta"
append using "Pericles.dta"
append using "Aesop.dta"
replace author_set = 2 if missing(author_set)
* Third set of authors
append using "BenjaminFranklin.dta"
append using "JohnWoolman.dta"
append using "WilliamPenn.dta"
append using "Epictetus.dta"
append using "MarcusAurelius.dta"
append using "FrancisBacon.dta"
append using "JohnMilton.dta"
append using "ThomasBrowne.dta"
append using "RalphWaldoEmerson.dta"
append using "RobertBurns.dta"
append using "Kempis.dta"
append using "Aeschylus.dta"
append using "Sophocles.dta"
append using "Euripides.dta"
append using "Aristophanes.dta"
append using "PlinytheYounger.dta"
append using "Plutarch.dta"
append using "Virgil.dta"
append using "Cervantes.dta"
append using "JohnBunyan.dta"
append using "IzaakWalton.dta"
append using "HansChristianAndersen.dta"
append using "Dryden.dta"
append using "OliverGoldsmith.dta"
append using "PercyByssheShelley.dta"
append using "RobertBrowning.dta"
append using "LordByron.dta"
append using "Goethe.dta"
append using "Marlowe.dta"
append using "DanteAlighieri.dta"
replace author_set = 3 if missing(author_set)
* Fourth set of authors
append using "AlessandroManzoni.dta"
append using "Homer.dta"
append using "PedroCalderóndelaBarca.dta"
append using "PierreCorneille.dta"
append using "JeanRacine.dta"
append using "Molière.dta"
append using "GottholdEphraimLessing.dta"
append using "Faraday.dta"
append using "Helmholtz.dta"
append using "Kelvin.dta"
append using "SimonNewcomb.dta"
append using "ArchibaldGeikie.dta"
append using "Cellini.dta"
append using "Montaigne.dta"
append using "SainteBeuve.dta"
append using "Renan.dta"
append using "Mazzini.dta"
append using "Herodotus.dta"
append using "Tacitus.dta"
append using "PhilipNichols.dta"
append using "FrancisPretty.dta"
append using "Bigges.dta"
append using "EdwardHaies.dta"
append using "WalterRaleigh.dta"
append using "Descartes.dta"
append using "Froissart.dta"
append using "Malory.dta"
append using "WilliamHarrison.dta"
append using "WilliamRoper.dta"
append using "ThomasMore.dta"
append using "Hippocrates.dta"
append using "AmbroiseParé.dta"
append using "WilliamHarvey.dta"
append using "EdwardJenner.dta"
append using "OliverWendellHolmes.dta"
append using "JosephLister.dta"
append using "Pasteur.dta"
append using "WilliamCaxton.dta"
append using "Copernicus.dta"
append using "JohnKnox.dta"
append using "EdmundSpenser.dta"
append using "Newton.dta"
append using "HenryFielding.dta"
append using "SamuelJohnson.dta"
append using "WilliamWordsworth.dta"
append using "VictorHugo.dta"
append using "WaltWhitman.dta"
append using "Hippolyte Taine.dta"
append using "Chaucer.dta"
replace author_set = 4 if missing(author_set)
* Fifth set of authors 
append using "Dilthey.dta"
append using "Frege.dta"
append using "Schleiermacher.dta"
append using "Schopenhauer.dta"
append using "Kafka.dta"
append using "Clausewitz.dta"
append using "FranzBrentano.dta"
append using "LudwigBüchner.dta"
append using "HermannCohen.dta"
append using "EduardvonHartmann.dta"
append using "Hölderlin.dta"
append using "WilhelmvonHumboldt.dta"
append using "OttoPfleiderer.dta"
append using "HermannLotze.dta"
append using "HeinrichFeder.dta"
append using "MosesMendelssohn.dta"
append using "FriedrichAst.dta"
append using "BrunoBauer.dta"
append using "SigismundBeck.dta"
append using "EduardBeneke.dta"
append using "AmadeusWendt.dta"
append using "WilhelmRoscher.dta"
append using "WilhelmDrobisch.dta"
append using "RudolfHaym.dta"
append using "GustavSchönberg.dta"
append using "OttoLiebmann.dta"
append using "FriedrichKrause.dta"
append using "ChristianSchreiber.dta"
append using "Wentscher.dta"
append using "TheodorLipps.dta"
append using "Ranke.dta"
append using "BartholdGeorgNiebuhr.dta"
append using "Herbart.dta"
append using "Herder.dta"
append using "LujoBrentano.dta"
append using "BernardBolzano.dta"
append using "Schäffle.dta"
append using "Hamann.dta"
append using "EugenDühring.dta"
append using "FritzSchultze.dta"
append using "MosesHess.dta"
append using "GottlobErnstSchulze.dta"
append using "ThomasAbbt.dta"
append using "DietrichTiedemann.dta"
append using "KunoFischer.dta"
append using "ChristianWilhelmvonDohm.dta"
append using "Natorp.dta"
append using "ArnoldRuge.dta"
append using "BrunoHildebrand.dta"
append using "KarlKnies.dta"
append using "Laspeyres.dta"
append using "FriedrichSchlegel.dta"
append using "Mainländer.dta"
append using "Scheler.dta"
append using "MaxStirner.dta"
append using "CarlStumpf.dta"
append using "FerdinandTönnies.dta"
append using "Windelband.dta"
append using "Eduard Zeller.dta"
append using "ThomasMann.dta"
append using "August Bebel.dta"
append using "EduardBernstein.dta"
append using "FriedrichHeinrichJacobi.dta"
append using "Wundt.dta"
append using "Simmel.dta"
append using "Grimmelshausen.dta"
append using "E. T. A. Hoffmann.dta"
append using "GustavFreytag.dta"
append using "TheodorFontane.dta"
append using "Rilke.dta"
append using "Külpe.dta"
append using "Ebbinghaus.dta"
append using "FriedrichCarlvonSavigny.dta"
append using "Sombart.dta"
append using "Schmoller.dta"
append using "Thünen.dta"
replace author_set = 5 if missing(author_set)
*
* Rename the English, German, and French variables to show they are citation counts
rename English cite_English
rename German cite_German
rename French cite_French
rename Spanish cite_Spanish

* For some reason, there are many observations with missing values of Year because blank spreadsheet rows were treated as observations. So drop these.
drop if missing(Year)
* Replace multiple spaces with single spaces in Name
replace Name = stritrim(Name)
* Remove trailing and leading blanks from Name
replace Name = strtrim(Name) 

* Save the final result
compress
save "all_author_Google_citations.dta", replace

/**********************************************************
Convert the Newspaper citations into a single DTA
*********************************************************/

* Import without the first row being variable names, because we want to preserve the spaces in the authors' names.
clear 
import excel "Marx newspaper citations (1870-1932).xlsx", sheet("Sheet1") 

* Rename each column (variable) to have the value of its first row, except spaces are replaced with
* underscores, which we will later replace with spaces again. (Variable names cannot contain spaces,
* but later, after we transpose the data, variable names will become variable values, which will permit 
* underscores again.) We also remove all punctuation and excess spaces.
ds 
local varlist = r(varlist)
foreach variable of local varlist {
	local firstrow = `variable'[1]
	local firstrow = subinstr("`firstrow'"," ","_",999)
	local firstrow = subinstr("`firstrow'","(","",999)
	local firstrow = subinstr("`firstrow'",")","",999)
	local firstrow = subinstr("`firstrow'","-","",999)
	local firstrow = subinstr("`firstrow'","*","",999)
	local firstrow = strtrim(stritrim("`firstrow'"))
	capture noisily rename `variable' `firstrow'
}

* Rename some variables 
* The variable Year18701932 actually has a carriage return in it, so it visually appears to be Year18701932, but that's actually not its 
* name. So strangely, we have to "rename Year Year".
rename Year Year 
rename Total_News TotalNews

* Drop the first row (which contains variable names) and destring the data 
* Then drop rows of blank data.
drop if _n == 1
destring *, replace
drop if missing(Year)

* Google Ngram normalizes by dividing citations of each phrase by total citations in a given year.
* Similarly, we divide each author's newspaper citations in a year by the total number of newspaper citations in a given year.
*
* ds lists every variable and saves in r(varlist)
ds
*
* Remove Year and TotalNews from r(varlist) to get a list of every author 
local authorlist = r(varlist)
local authorlist = subinstr("`authorlist'","Year","",999)
local authorlist = subinstr("`authorlist'","TotalNews","",999)
* 
* Loop over every author in authorlist and divide their count by TotalNews
* Next, replace missing values with zeroes
foreach author of local authorlist {
	capture replace `author' = `author' / TotalNews
	capture replace `author' = 0 if missing(`author')
}

* Drop TotalNews, which is no longer needed
drop TotalNews

* Normally, wide data are arranged with each row being a panel unit, and each column being a year.
* But our data are the opposite: each row is a year, and each column is a panel unit.
* So first, we transpose our data to create a wide dataset of the familiar format.
xpose, clear promote varname
rename _varname Name 

* Now, the variables have uninformative names (e.g. v1, v2, etc.) and the first row of data contains the years that we want to use as variable names.
* So use the first row to rename the variables, and then drop the first row. 
* We remove "Name" from the varlist to leave just the v1, v2, etc. variables in the list.
* Then we rename each variable.
* Finally, we drop the first row, which has Name == "Year".
ds 
local varlist = r(varlist)
local varlist = subinstr("`varlist'","Name","",999)
foreach variable of local varlist {
	local newname = `variable'[1]
	rename `variable' cite_news_`newname'
}
order Name
drop if Name == "Year"

* In the variable Name, replace underscores with spaces 
replace Name = subinstr(Name,"_"," ",999)

* Drop any rows with all zeroes, which indicate spreadsheet data there were originally blank but got replaced with zeroes by the destring.
ds 
local varlist = r(varlist)
local varlist = subinstr("`varlist'","Name","",999)
egen cite_news_mean = rowmean(`varlist')
drop if cite_news_mean <= 0
drop cite_news_mean

* Reshape wide to long
reshape long cite_news_, i(Name) j(Year)
rename cite_news_ cite_news

* Make sure any missing values are replaced with zeroes.
replace cite_news = 0 if missing(cite_news)

* To merge with all_author_Google_citations.dta, we need a 
* variable that concatenates Name and Year.
egen NameYear = concat(Name Year)

* Save the final result
compress
save "Newspaper_citations.dta", replace

/**********************************************************
Merge Google Ngram citations with newspaper citations
*********************************************************/
clear 

use "all_author_Google_citations.dta"
egen NameYear = concat(Name Year)

merge 1:1 NameYear using "Newspaper_citations.dta"

* Every author in the newspapers should be in Google Ngrams, but not vice-versa.
* So _match should be 1 or 3 but never 2.
assert _merge == 1 | _merge == 3 
assert _merge != 2

drop NameYear _merge

compress
save "all_author_citations.dta", replace

/**********************************************************
Convert the author indicator spreadsheets into a single DTA
*********************************************************/

clear
import excel "Marx_author_indicators - 1st set of authors - brainstorming.xlsx", sheet("Sheet1") firstrow
compress
save "Marx_author_indicators - 1st set of authors - brainstorming.dta", replace

clear
import excel "Marx_author_indicators - 2nd set of authors - pol phil readers.xlsx", sheet("Sheet1") firstrow
compress
save "Marx_author_indicators - 2nd set of authors - pol phil readers.dta", replace

clear
import excel "Marx_author_indicators - first 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Sheet1") firstrow
compress
save "Marx_author_indicators - first 20 vol of Harvard Classics (Eliot 1909).dta", replace

clear
import excel "Marx_author_indicators - second 20 vol of Harvard Classics (Eliot 1909).xlsx", sheet("Sheet1") firstrow
compress
save "Marx_author_indicators - second 20 vol of Harvard Classics (Eliot 1909).dta", replace

clear
import excel "Marx_author_indicators - German authors.xlsx", sheet("Sheet1") firstrow
compress
save "Marx_author_indicators - German authors.dta", replace

clear
use "Marx_author_indicators - 1st set of authors - brainstorming.dta"
append using "Marx_author_indicators - 2nd set of authors - pol phil readers.dta"
append using "Marx_author_indicators - first 20 vol of Harvard Classics (Eliot 1909).dta"
append using "Marx_author_indicators - second 20 vol of Harvard Classics (Eliot 1909).dta"
append using "Marx_author_indicators - German authors.dta"

* For some reason, there are many observations with missing values of Name because blank rows were treated as observations. So drop these
drop if missing(Name)
* Replace multiple spaces with single spaces in Name
replace Name = stritrim(Name)
* Remove trailing and leading blanks from Name
replace Name = strtrim(Name) 
* Remove all spaces whatsoever from OriginalLanguage
replace OriginalLanguage = subinstr(OriginalLanguage," ","",999)

* Save the result
compress
save "author_indicators.dta", replace
erase "Marx_author_indicators - 1st set of authors - brainstorming.dta"
erase "Marx_author_indicators - 2nd set of authors - pol phil readers.dta"
erase "Marx_author_indicators - first 20 vol of Harvard Classics (Eliot 1909).dta"
erase "Marx_author_indicators - second 20 vol of Harvard Classics (Eliot 1909).dta"
erase "Marx_author_indicators - German authors.dta"

/**********************************************************
* Merge the DTA file of citations with the DTA file of indicators, merging by
* author's name, i.e. the variable "Name."
* This will give us the final data file which we can use to perform regressions
*********************************************************/
clear
use "all_author_citations.dta"
merge m:1 Name using "author_indicators.dta"
compress
save "all_authors_with_citations_and_indicators.dta", replace

* Drop all observations for which we do not have both citations (from one dataset) 
* and author indicators (from another dataset)
* if _merge == 3, then an observation in one dataset was successfully matched to an 
* observation in the other, so keep those
tabulate Name if _merge == 1
tabulate Name if _merge == 2
drop if _merge != 3
drop _merge

* For some reason, synth fails if there is a period in someone's name. So remove all periods.
replace Name = subinstr(Name, ".", "",999)
* Just to be safe, remove any hyphens too.
replace Name = subinstr(Name, "-", "",999)

* Create dummy variables for language
generate wrote_English = 0
	replace wrote_English = 1 if OriginalLanguage == "English"
generate wrote_German = 0
	replace wrote_German = 1 if OriginalLanguage == "German"
generate wrote_French = 0
	replace wrote_French = 1 if OriginalLanguage == "French"
generate wrote_Greek = 0
	replace wrote_Greek = 1 if OriginalLanguage == "Greek"
generate wrote_Latin = 0
	replace wrote_Latin = 1 if OriginalLanguage == "Latin"
generate wrote_Spanish = 0
	replace wrote_Spanish = 1 if OriginalLanguage == "Spanish"
generate wrote_Italian = 0
	replace wrote_Italian = 1 if OriginalLanguage == "Italian"	

* Convert Name to numeric
/*
encode(Name), generate(Name_no)
label variable Name_no "Author's name (numeric - like ID)" 
tsset Name_no Year
*/

order Name Year cite_English cite_German cite_French Political Socialist MagnumOpus OriginalLanguage wrote_English wrote_German wrote_French wrote_Spanish wrote_Italian YearofPublication YearofTranslationtoEnglish Notes

* Relabel variables
label variable Name "Author's name"
label variable wrote_German "Wrote in German"
label variable wrote_English "Wrote in English"
label variable wrote_French "Wrote in French"
label variable wrote_Greek "Wrote in Greek"
label variable wrote_Latin "Wrote in Latin"
label variable wrote_Spanish "Wrote in Spanish"
label variable wrote_Italian "Wrote in Italian"
label variable cite_English "2019 Ngram citations - English - unsmoothed"
label variable cite_German "2019 Ngram citations - German - unsmoothed"
label variable cite_French "2019 Ngram citations - French - unsmoothed"
label variable cite_Spanish "2019 Ngram citations - Spanish - unsmoothed"
label variable cite_news "Newspaper.com citations percent"

* Now we have our final, ultimate dataset for performing regressions.
compress
save "all_authors_with_citations_and_indicators.dta", replace

* Finally, erase all the temporary DTA files we had to create
* First set
erase "KarlMarx.dta"
erase "Marx.dta"
erase "AdamSmith.dta"
erase "RobertOwen.dta"
erase "HenryGeorge.dta"
erase "HerbertSpencer.dta"
erase "AlexanderHamilton.dta"
erase "JamesMadison.dta"
erase "JohnStuartMill.dta"
erase "ThomasCarlyle.dta"
erase "JohnRuskin.dta"
erase "JohnLocke.dta"
erase "CharlesDarwin.dta"
erase "Proudhon.dta"
erase "Kropotkin.dta"
erase "Blanqui.dta"
erase "Tocqueville.dta"
erase "Bakunin.dta"
erase "ImmanuelKant.dta"
erase "DavidRicardo.dta"
erase "Bastiat.dta"
erase "Malthus.dta"
erase "Montesquieu.dta"
erase "EdmundBurke.dta"
erase "LudwigFeuerbach.dta"
erase "Machiavelli.dta"
erase "Rodbertus.dta"
erase "Hobbes.dta"
erase "ThomasJefferson.dta"
erase "Fichte.dta"
erase "Aristotle.dta"
erase "Plato.dta"
erase "Voltaire.dta"
erase "WilliamGrahamSumner.dta"
erase "AuberonHerbert.dta"
erase "LordActon.dta"
erase "CharlesFourier.dta"
erase "EdwardBellamy.dta"
erase "Wollstonecraft.dta"
erase "Spinoza.dta"
erase "Hume.dta"
erase "Bentham.dta"
erase "JohnCCalhoun.dta"
erase "FriedrichList.dta"
erase "Durkheim.dta"
erase "FerdinandLassalle.dta"
erase "AugusteComte.dta"
erase "Sismondi.dta"
erase "Rousseau.dta"
erase "WilliamGodwin.dta"
erase "NassauSenior.dta"
erase "Leibniz.dta"
erase "AlexanderPope.dta"
erase "Hegel.dta"
* Second set
erase "Thoreau.dta"
erase "BenjaminConstant.dta"
erase "JamesFitzjamesStephen.dta"
erase "RichardCobden.dta"
erase "Nietzsche.dta"
erase "OscarWilde.dta"
erase "FriedrichSchiller.dta"
erase "Dostoyevsky.dta"
erase "Thucydides.dta"
erase "Cicero.dta"
erase "Augustine.dta"
erase "Aquinas.dta"
erase "MartinLuther.dta"
erase "JohnCalvin.dta"
erase "JonathanSwift.dta"
erase "deGouges.dta"
erase "FrederickDouglass.dta"
erase "AbrahamLincoln.dta"
erase "Pericles.dta"
erase "Aesop.dta"
* Third set
erase "BenjaminFranklin.dta"
erase "JohnWoolman.dta"
erase "WilliamPenn.dta"
erase "Epictetus.dta"
erase "MarcusAurelius.dta"
erase "FrancisBacon.dta"
erase "JohnMilton.dta"
erase "ThomasBrowne.dta"
erase "RalphWaldoEmerson.dta"
erase "RobertBurns.dta"
erase "Kempis.dta"
erase "Aeschylus.dta"
erase "Sophocles.dta"
erase "Euripides.dta"
erase "Aristophanes.dta"
erase "PlinytheYounger.dta"
erase "Plutarch.dta"
erase "Virgil.dta"
erase "Cervantes.dta"
erase "JohnBunyan.dta"
erase "IzaakWalton.dta"
erase "HansChristianAndersen.dta"
erase "Dryden.dta"
erase "OliverGoldsmith.dta"
erase "PercyByssheShelley.dta"
erase "RobertBrowning.dta"
erase "LordByron.dta"
erase "Goethe.dta"
erase "Marlowe.dta"
erase "DanteAlighieri.dta"
* Fourth set
erase "AlessandroManzoni.dta"
erase "Homer.dta"
erase "PedroCalderóndelaBarca.dta"
erase "PierreCorneille.dta"
erase "JeanRacine.dta"
erase "Molière.dta"
erase "GottholdEphraimLessing.dta"
erase "Faraday.dta"
erase "Helmholtz.dta"
erase "Kelvin.dta"
erase "SimonNewcomb.dta"
erase "ArchibaldGeikie.dta"
erase "Cellini.dta"
erase "Montaigne.dta"
erase "SainteBeuve.dta"
erase "Renan.dta"
erase "Mazzini.dta"
erase "Herodotus.dta"
erase "Tacitus.dta"
erase "PhilipNichols.dta"
erase "FrancisPretty.dta"
erase "Bigges.dta"
erase "EdwardHaies.dta"
erase "WalterRaleigh.dta"
erase "Descartes.dta"
erase "Froissart.dta"
erase "Malory.dta"
erase "WilliamHarrison.dta"
erase "WilliamRoper.dta"
erase "ThomasMore.dta"
erase "Hippocrates.dta"
erase "AmbroiseParé.dta"
erase "WilliamHarvey.dta"
erase "EdwardJenner.dta"
erase "OliverWendellHolmes.dta"
erase "JosephLister.dta"
erase "Pasteur.dta"
erase "WilliamCaxton.dta"
erase "Copernicus.dta"
erase "JohnKnox.dta"
erase "EdmundSpenser.dta"
erase "Newton.dta"
erase "HenryFielding.dta"
erase "SamuelJohnson.dta"
erase "WilliamWordsworth.dta"
erase "VictorHugo.dta"
erase "WaltWhitman.dta"
erase "Hippolyte Taine.dta"
erase "Chaucer.dta"
* Fifth set
erase "Dilthey.dta"
erase "Frege.dta"
erase "Schleiermacher.dta"
erase "Schopenhauer.dta"
erase "Kafka.dta"
erase "Clausewitz.dta"
erase "FranzBrentano.dta"
erase "LudwigBüchner.dta"
erase "HermannCohen.dta"
erase "EduardvonHartmann.dta"
erase "Hölderlin.dta"
erase "WilhelmvonHumboldt.dta"
erase "OttoPfleiderer.dta"
erase "HermannLotze.dta"
erase "HeinrichFeder.dta"
erase "MosesMendelssohn.dta"
erase "FriedrichAst.dta"
erase "BrunoBauer.dta"
erase "SigismundBeck.dta"
erase "EduardBeneke.dta"
erase "AmadeusWendt.dta"
erase "WilhelmRoscher.dta"
erase "WilhelmDrobisch.dta"
erase "RudolfHaym.dta"
erase "GustavSchönberg.dta"
erase "OttoLiebmann.dta"
erase "FriedrichKrause.dta"
erase "ChristianSchreiber.dta"
erase "Wentscher.dta"
erase "TheodorLipps.dta"
erase "Ranke.dta"
erase "BartholdGeorgNiebuhr.dta"
erase "Herbart.dta"
erase "Herder.dta"
erase "LujoBrentano.dta"
erase "BernardBolzano.dta"
erase "Schäffle.dta"
erase "Hamann.dta"
erase "EugenDühring.dta"
erase "FritzSchultze.dta"
erase "MosesHess.dta"
erase "GottlobErnstSchulze.dta"
erase "ThomasAbbt.dta"
erase "DietrichTiedemann.dta"
erase "KunoFischer.dta"
erase "ChristianWilhelmvonDohm.dta"
erase "Natorp.dta"
erase "ArnoldRuge.dta"
erase "BrunoHildebrand.dta"
erase "KarlKnies.dta"
erase "Laspeyres.dta"
erase "FriedrichSchlegel.dta"
erase "Mainländer.dta"
erase "Scheler.dta"
erase "MaxStirner.dta"
erase "CarlStumpf.dta"
erase "FerdinandTönnies.dta"
erase "Windelband.dta"
erase "Eduard Zeller.dta"
erase "ThomasMann.dta"
erase "August Bebel.dta"
erase "EduardBernstein.dta"
erase "FriedrichHeinrichJacobi.dta"
erase "Wundt.dta"
erase "Simmel.dta"
erase "Grimmelshausen.dta"
erase "E. T. A. Hoffmann.dta"
erase "GustavFreytag.dta"
erase "TheodorFontane.dta"
erase "Rilke.dta"
erase "Külpe.dta"
erase "Ebbinghaus.dta"
erase "FriedrichCarlvonSavigny.dta"
erase "Sombart.dta"
erase "Schmoller.dta"
erase "Thünen.dta"
erase "author_indicators.dta"
erase "all_author_citations.dta"
erase "all_author_Google_citations.dta"
erase "Newspaper_citations.dta"

* Cleanup
clear